<?php

/*
	info: 系统初始化
	base: 无
	$Id: init.inc.php 14 2011-08-29 08:48:19Z lfly1573@gmail.com $
*/

/* PHP版本限制 */
version_compare(PHP_VERSION, '5.0.0', '<') and exit('You should upgrade to PHP 5.0.0 or later.');

/* 系统环境设定 */
@ini_set('magic_quotes_runtime', 0);
@ini_set('memory_limit',    '128M');
@set_time_limit(600);

/* 系统常量定义 */
define('WEB_IN', TRUE);
define('WEB_ROOT', substr(dirname(__FILE__), 0, -8));
define('WEB_STARTED', microtime(TRUE));
define('WEB_TIME', time());

/* 自动加载类文件 */
function __autoload($strClassName)
{
	$strIncludeFile = '';
	$strClassPre = substr($strClassName, 0, 2);
	if ($strClassPre == 'A_')
	{
		$strIncludeFile = '/action/'.str_replace('_', '/', strtolower(substr($strClassName, 2))).'.class.php';
	}
	elseif ($strClassPre == 'M_')
	{
		$strIncludeFile = '/module/'.str_replace('_', '/', strtolower(substr($strClassName, 2))).'.class.php';
	}
	else
	{
		$strIncludeFile = '/library/'.str_replace('_', '/', strtolower($strClassName)).'.class.php';
	}
	$bolInclude = ($strIncludeFile!='') ? (@include WEB_ROOT.$strIncludeFile) : FALSE;
	if ($bolInclude === FALSE)
	{
		exit("Can not load class: {$strClassName}.");
	}
}

?>